<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <meta http-equiv="Content-Style-Type" content="text/css" />
  <meta name="generator" content="pandoc" />
  <meta name="author" content="John Labenski, Francesco Montorsi" />
  <meta name="date" content="2013-09-10" />
  <title>wxLua 2.8.12.3 - Installation Guide</title>
  <style type="text/css">code{white-space: pre;}</style>
  <style type="text/css">
table.sourceCode, tr.sourceCode, td.lineNumbers, td.sourceCode {
  margin: 0; padding: 0; vertical-align: baseline; border: none; }
table.sourceCode { width: 100%; line-height: 100%; }
td.lineNumbers { text-align: right; padding-right: 4px; padding-left: 4px; color: #aaaaaa; border-right: 1px solid #aaaaaa; }
td.sourceCode { padding-left: 5px; }
code > span.kw { color: #007020; font-weight: bold; }
code > span.dt { color: #902000; }
code > span.dv { color: #40a070; }
code > span.bn { color: #40a070; }
code > span.fl { color: #40a070; }
code > span.ch { color: #4070a0; }
code > span.st { color: #4070a0; }
code > span.co { color: #60a0b0; font-style: italic; }
code > span.ot { color: #007020; }
code > span.al { color: #ff0000; font-weight: bold; }
code > span.fu { color: #06287e; }
code > span.er { color: #ff0000; font-weight: bold; }
  </style>
  <link rel="stylesheet" href="wxlua.css" type="text/css" />
</head>
<body>
<div id="header">
<h1 class="title">wxLua 2.8.12.3 - Installation Guide</h1>
<h2 class="author">John Labenski, Francesco Montorsi</h2>
<h3 class="date">2013-09-10</h3>
</div>
<p>This document describes how to build the wxLua libraries, editors, and interpreters. wxLua is written in C and C++ and can be built on MS Windows, Linux, and OSX with the Visual Studio, Borland, Watcom, MingW, and GCC compilers. Most of the build settings and platforms that are supported by wxWidgets are supported by wxLua.</p>
<h2 id="table-of-contents">Table of Contents</h2>
<ol style="list-style-type: decimal">
<li><a href="#C1">Required Libraries (dependencies)</a></li>
<li><a href="#C2">Building wxWidgets</a><br /> 2.1 <a href="#C2.1">Getting the wxWidgets Source Code</a><br /> 2.2 <a href="#C2.2">Build using Microsoft Visual Studio GUI</a><br /> 2.3 <a href="#C2.3">Build using MSVC NMake</a><br /> 2.4 <a href="#C2.4">Build using MinGW</a><br /> 2.5 <a href="#C2.5">Build using GCC in Linux</a><br /> 2.6 <a href="#C2.6">Build using GCC in OSX</a></li>
<li><a href="#C3">wxLua Components</a><br /> 3.1 <a href="#C3.1">wxLua applications</a><br /> 3.2 <a href="#C3.2">wxLua libraries</a><br /> 3.3 <a href="#C3.3">wxLua utilities</a></li>
<li><a href="#C4">Building wxLua</a><br /> 4.1 <a href="#C4.1">Getting the wxLua Source Code</a><br /> 4.2 <a href="#C4.2">Initial CMake Setup</a><br /> 4.3 <a href="#C4.3">CMake Configuration Variables</a><br /> 4.4 <a href="#C4.4">CMake with MSVC</a><br /> 4.5 <a href="#C4.5">CMake with MinGW</a><br /> 4.6 <a href="#C4.6">CMake with GCC in Linux and OSX</a></li>
<li><a href="#C5">Advanced building options</a><br /> 5.1 <a href="#C5.1">Building a minimal set of wxWidgets wrappers</a><br /> 5.2 <a href="#C5.2">Embedding wxLua into a C++ Application</a><br /> 5.2 <a href="#C5.3">wxLua libraries and linking order</a></li>
</ol>
<p><a name="C1"/></p>
<h2 id="required-libraries-dependencies">1 - Required Libraries (dependencies)</h2>
<p>wxWidgets - Version 2.8.x or 2.9.x</p>
<ul>
<li><a href="http://www.wxwidgets.org">http://www.wxwidgets.org</a></li>
<li>Please see <a href="#C2">Building wxWidgets</a> for information about building wxWidgets on a variety of platforms.</li>
<li>The wxStyledTextCtrl (wxSTC) library is a wrapper around the Scintilla text editor control and is required to build the <code>wxlua</code> and <code>wxluaedit</code> applications and the <code>wxbindstc</code> binding library.
<ul>
<li>wxWidgets &lt; 2.9 Windows users can build the wxSTC library using the makefiles or the MSVC build files in <code>contrib/stc/stc</code>.</li>
<li>wxWidgets &lt; 2.9 Unix/OSX users can use the Makefile in created in <code>contrib/src/stc</code> after you have run <code>configure</code> and have successfully built the main wxWidgets libraries.</li>
<li>wxWidgets &gt;= 2.9 has wxSTC built in and there is no longer a <code>wxWidgets/contrib</code> directory.</li>
</ul></li>
<li><strong>Before attempting to compile wxLua you should be able to compile and successfully run at least one of the wxWidgets samples.</strong></li>
</ul>
<p>wxSTEdit - Version 1.2.6 or higher.</p>
<ul>
<li><a href="http://wxcode.sourceforge.net">http://wxcode.sourceforge.net</a> and <a href="http://wxcode.sourceforge.net/components/stedit">http://wxcode.sourceforge.net/components/stedit/</a></li>
<li>The source code is included in <code>wxLua/modules/wxstedit</code></li>
<li>There is more information about wxStEdit with the source code.</li>
<li>By default, wxStEdit will be built automatically when you build wxLua.</li>
</ul>
<p>Lua - Version 5.1 and 5.2</p>
<ul>
<li>wxLua comes with the Lua 5.1.5 and 5.2.2 source files to build both the Lua library and Lua executable.</li>
<li>It is is the unmodified source, except that bug-fix patches have been applied. Please see <a href="changelog.txt">wxLua/docs/changelog.txt</a> to learn which ones. <a href="http://www.lua.org/bugs.html">http://www.lua.org/bugs.html</a></li>
<li>An external Lua development library may be used to build wxLua against your own Lua library as described below.</li>
</ul>
<p><a name="C2"/></p>
<h2 id="building-wxwidgets">2 - Building wxWidgets</h2>
<p>wxWidgets is fairly easy to build from its source code. You should build it yourself in MS Windows and in OSX using the instructions below, refering to the wxWidgets documentation as needed. In Linux, you can use the precompiled development distribution packages, if available, or build it yourself.</p>
<p><a name="C2.1"/></p>
<h3 id="getting-the-wxwidgets-source-code">2.1 - Getting the wxWidgets Source Code</h3>
<ul>
<li>Download a source code archive <a href="http://wxwidgets.org/downloads/">http://wxwidgets.org/downloads/</a> for your platform.</li>
<li>Or use subversion to get the most up to date source code or the code at a specific revision number.
<ul>
<li>For more information see here : <a href="http://www.wxwidgets.org/develop/svn.htm">http://www.wxwidgets.org/develop/svn.htm</a></li>
<li>To get the latest trunk, version 2.9.x at this time, use this command
<ul>
<li><code>svn checkout http://svn.wxwidgets.org/svn/wx/wxWidgets/trunk wxWidgets-trunk</code></li>
</ul></li>
<li>To get the latest 2.8.x version use this command:
<ul>
<li><code>svn checkout http://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH wxWidgets-2.8</code></li>
</ul></li>
</ul></li>
<li>Do not checkout into a directory name with spaces to make your life easier.</li>
</ul>
<p><a name="C2.2"/></p>
<h3 id="build-using-microsoft-visual-studio-gui">2.2 - Build using Microsoft Visual Studio GUI</h3>
<ul>
<li>If you want to modify the default configuration, copy <code>wxWidgets\include\wx\msw\setup0.h</code> to <code>wxWidgets\include\wx\msw\setup.h</code> and adjust as desired.</li>
<li>The file should be automatically copied over, but in case you get a compiler error about not finding <code>&quot;wx/msw/setup.h&quot;</code> copy it by hand.</li>
<li>There are comments above each #define describing the setting.</li>
<li><p>However, you might want to compile wxWidgets and wxLua with the default settings at least once before trying more advanced settings.</p></li>
<li>For wxWidgets &lt; 2.9 open <code>wxWidgets\build\msw\wx.dsw</code> (written for for MSVC 6) and allow MSVC to convert it for a newer version of MSVC if asked.</li>
<li><p>For wxWidgets &gt;= 2.9 open the appropriate solution file <code>wxWidgets\build\msw\wx_vc9.sln</code> (for MSVC 2008 for example) or the one closest to the version of MSVC you use.</p></li>
<li><p>64-bit builds (MSVC &gt; 6 only, the steps below are for MSVC 2008 and note that a default MSVC install does not install the 64-bit compiler, you must do a custom MSVC install)</p></li>
</ul>
<blockquote>
<ol style="list-style-type: decimal">
<li>Right-click on the main &quot;Solution&quot; to bring up the menu.</li>
<li>Select &quot;Properties...&quot; to get the properties dialog.</li>
<li>Select &quot;Configuration Properties&quot; on the left.</li>
<li>Then the &quot;Configuration Manager...&quot; button in the top-right to get another dialog.</li>
<li>Drop down the &quot;Active Solution Platform&quot; choice and select &quot;x64&quot; and copy settings from &quot;Win32&quot; and check &quot;Create new project platforms.&quot;</li>
</ol>
</blockquote>
<ul>
<li>The recommended build configurations are &quot;Debug&quot; and &quot;Release&quot; which build static libraries.</li>
<li>If you really want DLLs choose &quot;Debug DLL&quot; or &quot;Release DLL&quot;. Remember to copy the wxWidgets DLLs into the wxLua bin dir or set the %PATH% environment variable to their directory.</li>
<li>The &quot;Universal&quot; configurations build wxWidgets with a &quot;Universal&quot; widget toolkit as opposed to native MS Windows widgets.
<ul>
<li>Note that this configuration has not been tested with wxLua extensively.</li>
</ul></li>
<li>Either choose the desired &quot;Solution Config&quot; and &quot;Solution Platform&quot; from the toolbar and press the build button or right-click on the main solution and choose &quot;Build Solution&quot;.</li>
<li>Or select the menu item &quot;Build&quot;-&gt;&quot;Batch Build...&quot; and check the projects you want built (note that you can sort the columns in MSVC &gt;= 2008).</li>
<li><p>It is best to simply build ALL the wxWidgets libraries per configuration since you can choose to not link wxLua to them if you don't want them. This will guarantee that they're all built the same way as opposed to building a few now and deciding you want more later, but forgetting you changed <code>setup.h</code> in between... You'll end up with mismatched libs leading to very strange and hard to debug crashes.</p></li>
<li><p>For wxWidgets 2.8.x you will also need to open <code>wxWidgets\contrib\build\stc\stc.dsw</code> and build the Scintilla and wxStyledTextCtrl library for each configuration too.</p></li>
<li><p>Hopefully it will all build... You shouldn't have any problems if you don't modify the <code>wx/msw/setup.h</code> file too much.</p></li>
</ul>
<p><a name="C2.3"/></p>
<h3 id="build-using-msvc-nmake">2.3 - Build using MSVC NMake</h3>
<ul>
<li>Open a <code>cmd.exe</code> (DOS) prompt and <code>cd wxWidgets\build\msw\</code></li>
<li>You need to setup the environment before running <code>nmake.exe</code>
<ul>
<li>For 32-bit Visual Studio 2008 run this
<ul>
<li><code>c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\vcvars32.bat</code></li>
</ul></li>
<li>For 64-bit Visual Studio 2008 run this
<ul>
<li><code>c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\amd64\vcvarsamd64.bat</code></li>
</ul></li>
<li>For 32-bit Visual Studio 6 run this
<ul>
<li><code>c:\Program Files\Microsoft Visual Studio\VC98\Bin\VCVARS32.BAT</code></li>
</ul></li>
<li>For other versions or different install directories run the appropriate command...</li>
</ul></li>
<li><p>The build is configured by <code>config.vc</code>, but don't edit it, rather override the default values of the variables on the <code>nmake</code> command line.</p></li>
<li>To build static libs run this command :
<ul>
<li>32-bit : <code>nmake -f makefile.vc SHARED=0 UNICODE=[0,1] BUILD=[debug,release]</code></li>
<li>64-bit : <code>nmake -f makefile.vc SHARED=0 UNICODE=[0,1] BUILD=[debug,release] TARGET_CPU=AMD64</code></li>
<li>Where typically <code>UNICODE=1</code> and <code>BUILD=release</code> would be appropriate.</li>
</ul></li>
<li>To build shared libs (DLLs) run this command :
<ul>
<li>32-bit : <code>nmake -f makefile.vc SHARED=1 UNICODE=[0,1] BUILD=[debug,release] MONOLITHIC=1</code></li>
<li>64-bit : <code>nmake -f makefile.vc SHARED=1 UNICODE=[0,1] BUILD=[debug,release] MONOLITHIC=1 TARGET_CPU=AMD64</code></li>
<li>Where typically <code>UNICODE=1</code> and <code>BUILD=release</code> would be appropriate.</li>
<li>Note that monolithic means that only a single DLL will be created which usually easier to work with, but wxLua can work with the non-monolithic libraries too.</li>
</ul></li>
<li><p>You can run any and all of the commands above to build multiple configurations since the generated libs will not conflict with each other in the <code>wxWidgets/lib</code> directory.</p></li>
<li><p>For wxWidgets 2.8.x you will also need to <code>cd wxWidgets\contrib\build\stc\</code> and run the exact same <code>nmake.exe ...</code> command to build the wxStyledTextCtrl lib.</p></li>
</ul>
<p><a name="C2.4"/></p>
<h3 id="build-using-mingw">2.4 - Build using MinGW</h3>
<ul>
<li>Download mingw-get-inst-20120426.exe or an appropriate newer version to automatically download and install a fully working system.</li>
<li>Run the installer and select &quot;C Compiler,&quot; &quot;C++ Compiler,&quot; &quot;MSYS Basic System,&quot; and the &quot;MinGW Developer Toolkit&quot; at minimum.
<ul>
<li>It is probably best to install to a directory without a space in the name, typically <code>c:\MinGW</code>.</li>
</ul></li>
<li>Open a <code>cmd.exe</code> (DOS) prompt and <code>cd wxWidgets\build\msw\</code>
<ul>
<li>Run <code>set PATH=C:\MinGW\bin;%PATH%</code> so that the compiler can be found.</li>
<li>Or optionally add to a system wide PATH environment variable to point to the <code>C:\MinGW\bin</code> directory.</li>
</ul></li>
<li>Or use the MinGW shell and <code>cd /c/path/to/wxWidgets/build/msw</code>.
<ul>
<li>The MinGW shell has MinGW/bin PATH already set, but note that this shell is a Linux (Cygwin) shell rather than a DOS shell so it works a little differently.</li>
<li>If you are unfamiliar with Unix or Linux you should probably use the <code>cmd.exe</code> (DOS) prompt.</li>
<li>Briefly; use <code>/</code> forward-slashes instead of <code>\</code> back-slashes for path separators.</li>
<li>Drives are accessed using <code>/c/...</code> or <code>/d/...</code> instead of <code>c:</code> or <code>d:</code>.</li>
</ul></li>
<li>The build is configured by <code>config.gcc</code>, but don't edit it, rather override the default values of the variables on the <code>make</code> command line.</li>
<li>To build static libs run this command :
<ul>
<li>32-bit : <code>mingw32-make.exe -f makefile.gcc SHARED=0 UNICODE=1 BUILD=[debug,release]</code></li>
</ul></li>
<li>To build shared libs (DLLs) run this command :
<ul>
<li>32-bit : <code>mingw32-make.exe -f makefile.gcc SHARED=1 UNICODE=1 BUILD=[debug,release] MONOLITHIC=1</code></li>
</ul></li>
<li>You can speed up compilation using multiple processors by adding the flag <code>-jN</code>, e.g. <code>-j4</code> to use four processors.
<ul>
<li>Note that you may have to run <code>make</code> multiple times since you may initially get errors since the compilers are not synced.</li>
</ul></li>
<li>For wxWidgets 2.8.x you will also need to <code>cd wxWidgets\contrib\build\stc\</code> and run the exact same <code>mingw32-make.exe ...</code> command to build the wxStyledTextCtrl lib.</li>
</ul>
<p><a name="C2.5"/></p>
<h3 id="build-using-gcc-in-linux">2.5 - Build using GCC in Linux</h3>
<ul>
<li>Install the wxwidgets and wxwidgets-devel prebuilt packages for your Linux distribution and you're done...
<ul>
<li>They may be called wxBase, wxGTK and wxBase-devel, wxGTK-devel.</li>
</ul></li>
<li>Or install the required development packages needed to build wxWidgets yourself.
<ul>
<li>Below is a list for Fedora 15, but they should be named similarly on other distributions.</li>
<li>There are others, but hopefully they'llbe dependent on the packages below so you won't need to explicitly install them.</li>
</ul></li>
</ul>
<pre><code>        glibc-headers
        cairo, cairo-devel
        GConf2, GConf2-devel
        gstreamer, gstreamer-devel, gstreamer-plugins-base, gstreamer-plugins-base-devel
        gtk2, gtk2-devel
        libjpeg, libjpeg-devel
        libpng, libpng-devel
        libtiff, libtiff-devel
        libXinerama, libXinerama-devel
        mesa-libGL, mesa-libGL-devel, mesa-libGLU, mesa-libGLU-devel
        pango, pango-devel</code></pre>
<ul>
<li>In the example below a GTK2, Unicode, Debug build will be created, <code>gtk2ud</code>.</li>
<li>Create a sub-directory in the wxWidgets directory for the build files.
<ul>
<li>You can create this directory anywhere, but it is convenient to keep it contained within the wxWidgets directory.</li>
<li>E.G. <code>wxWidgets/build_gtk2ud</code> for a GTK2, Unicode, Debug build.</li>
</ul></li>
<li>Create a script in the build directory named <code>configure-gtk2ud.sh</code> (or named appropriately) with this as its content :</li>
</ul>
<pre><code>    ../configure --prefix=$PWD \
                 --enable-gtk2 \
                 --enable-unicode \
                 --enable-shared \
                 --enable-optimise=no \
                 --enable-mem_tracing=no \
                 --enable-profile=no \
                 --with-dmalloc=no \
                 \
                 --enable-debug \
                 --enable-debug_flag \
                 --enable-debug_info \
                 --enable-debug_gdb \
                 --enable-debug_cntxt \
                 \
                 --with-sdl \
                 --with-gnomeprint \
                 \
                 --with-opengl \
                 --enable-sound \
                 --enable-mediactrl \
                 --enable-graphics_ctx \
                 --enable-controls \
                 --enable-dataviewctrl 2&gt;&amp;1 | tee configure-gtk2ud.log</code></pre>
<ul>
<li>This enables most everything and you can adjust it as required.</li>
<li>Note that the <code>configure</code> script in the root wxWidgets source directory will generate the build files in the directory it is run from so do not run it in the root wxWidgets dir.</li>
<li>Review the output file, <code>configure-gtk2ud.log</code>, to find any problems.</li>
<li>On success, you can then run <code>make -j4</code> (set 4 to the number of processors you have) to build wxWidgets.</li>
<li>The build settings are created in the shell script <code>wx-config</code>.
<ul>
<li>Run <code>./wx-config --prefix</code> and <code>./wx-config --cxxflags</code> and <code>./wx-config --libs</code> to print the wxWidgets build settings.</li>
</ul></li>
<li>You DO NOT NEED to run <code>make install</code> and in fact by setting <code>--prefix=$PWD</code> it would only be installed to the build directory where it already is.
<ul>
<li>If you must install it, adjust the <code>--prefix</code> directory as desired.</li>
</ul></li>
<li><p>For wxWidgets 2.8.x you will also need to <code>cd wxWidgets/build_gtk2ud/contrib/src/stc/</code> and run <code>make</code> to build the wxStyledTextCtrl lib.</p></li>
<li><p>Build a wxWidgets sample program as a sanity check, <code>samples/widgets</code> for example, <code>cd build_gtk2ud/samples/widgets</code>, run <code>make</code>, then <code>./widgets</code> to execute it.</p></li>
</ul>
<p><a name="C2.6"/></p>
<h3 id="build-using-gcc-in-osx">2.6 - Build using GCC in OSX</h3>
<ul>
<li>Install XCode which should install the command line GCC tools, the &quot;app store&quot; should have it.</li>
<li><p>You should use wxWidgets &gt;= 2.9 on OSX, there is no good reason to use 2.8.x.</p></li>
<li>In the example below an OSX, Unicode, Debug build will be created, <code>osx2ud</code>.</li>
<li>Create a sub-directory in the wxWidgets directory for the build files.
<ul>
<li>You can create this directory anywhere, but it is convenient to keep it contained within the wxWidgets directory.</li>
<li>E.G. <code>wxWidgets/build_osxud</code> for a OSX, Unicode, Debug build.</li>
</ul></li>
<li><p>Create a script in the build directory named <code>configure-osxud.sh</code> (or named appropriately) with this as its content :</p></li>
</ul>
<pre><code>    ../configure --prefix=$PWD \
                 --with-osx-cocoa \
                 --enable-unicode \
                 --disable-shared \
                 --enable-optimise=no \
                 --enable-mem_tracing=no \
                 --enable-profile=no \
                 --with-dmalloc=no \
                 \
                 --enable-debug \
                 --enable-debug_flag \
                 --enable-debug_info \
                 --enable-debug_gdb \
                 --enable-debug_cntxt \
                 \
                 --with-opengl \
                 --enable-sound \
                 --enable-mediactrl \
                 --enable-graphics_ctx \
                 --enable-controls \
                 --enable-dataviewctrl 2&gt;&amp;1 | tee configure-osx2ud.log</code></pre>
<ul>
<li>This enables most everything and you can adjust it as required.</li>
<li>Note that the <code>configure</code> script in the root wxWidgets source directory will generate the build files in the directory it is run from so do not run it in the root wxWidgets dir.</li>
<li>Review the output file, <code>configure-osxud.log</code>, to find any problems.</li>
<li>On success, you can then run <code>make -j4</code> (set 4 to the number of processors you have) to build wxWidgets.</li>
<li>The build settings are created in the shell script <code>wx-config</code>.
<ul>
<li>Run <code>./wx-config --prefix</code> and <code>./wx-config --cxxflags</code> and <code>./wx-config --libs</code> to print the wxWidgets build settings.</li>
</ul></li>
<li>You DO NOT NEED to run <code>make install</code> and in fact by setting <code>--prefix=$PWD</code> it would only be installed to the build directory where it already is.
<ul>
<li>If you must install it, adjust the <code>--prefix</code> directory as desired.</li>
</ul></li>
<li><p>For wxWidgets 2.8.x you will also need to <code>cd wxWidgets/build_osxud/contrib/src/stc/</code> and run <code>make</code> build the wxStyledTextCtrl lib.</p></li>
<li><p>Build a wxWidgets sample program as a sanity check, <code>samples/widgets</code> for example, <code>cd build_osxud/samples/widgets</code>, run <code>make</code>, then <code>./widgets</code> to execute it.</p></li>
</ul>
<p><a name="C3"/></p>
<h2 id="wxlua-components">3 - wxLua Components</h2>
<p>wxLua has three components: applications (<code>wxLua/apps</code>), modules (<code>wxLua/modules</code>), and utilities (<code>wxLua/utils</code>). You should simply build them all.</p>
<p><a name="C3.1"/></p>
<h3 id="wxlua-applications">3.1 - wxLua applications</h3>
<ul>
<li><code>wxLua/apps/wxlua</code>
<ul>
<li>A wxLua code editor, interpreter, and debugger; runs an embedded copy of the Lua program <code>samples/editor.wx.lua</code>.</li>
</ul></li>
<li><code>wxLua/apps/wxluaedit</code>
<ul>
<li>Another wxLua code editor and interpreter, based on wxStEdit.</li>
</ul></li>
<li><code>wxLua/apps/wxluafreeze</code>
<ul>
<li>A simple program to execute Lua or wxLua programs that can be used as a replacement for the Lua executable that is capable of running wxLua apps.</li>
</ul></li>
<li><code>wxLua/apps/wxluacan</code>
<ul>
<li>An example of how to create a C++ application with an embedded wxLua interpreter.</li>
</ul></li>
</ul>
<p><a name="C3.2"/></p>
<h3 id="wxlua-libraries">3.2 - wxLua libraries</h3>
<ul>
<li><code>wxLua/modules/lua-5.1</code>
<ul>
<li>Lua 5.1.x sources with patches applied.</li>
</ul></li>
<li><code>wxLua/modules/lua-5.2</code>
<ul>
<li>Lua 5.2.x sources with patches applied.</li>
</ul></li>
<li><code>wxLua/modules/luamodule</code>
<ul>
<li>A shared library (wx.so or wx.dll) for Lua code to call <code>require(&quot;wx&quot;)</code> to load the wxLua bindings.</li>
</ul></li>
<li><code>wxLua/modules/luaproxydll</code>
<ul>
<li>MS Windows only libraries that allow a staticly built lua.exe to look and act like the lua.dll shared library.</li>
<li>Briefly, a staticly built lua.exe contains all of the compiled Lua code and is a stand-alone application. A shared lua.exe would be linked to a lua.dll which would contain the code and so the lua.exe and lua.dll must be kept together or the lua.dll must at least be in the %PATH%.</li>
<li>The luaproxydll directory contains prebuilt shared libraries lua5.1.dll, lua51.dll, lua5.2.dll, and lua52.dll that when loaded by an application (lua.exe) simply points the load request back to the caller application itself to find the functions and symbols.</li>
<li>This allows the same static lua.exe to be used to as a convenient stand-alone application, but also as the lua.dll when calling <code class="sourceCode lua"><span class="fu">require</span><span class="ot">(</span><span class="st">&quot;wx&quot;</span><span class="ot">)</span></code> from Lua code.</li>
<li>Additionally, it simplifies the usage of prebuilt 3rd-party libraries which may be linked against Lua dlls with nearly any name. Simply make a copy of one of the appropriate luaproxydll file, lua51.dll or lua52.dll, and give it the name the 3rd-party library was originaly linked to.</li>
<li>Note that this does NOT give you license to mix and match libraries of different versions or that were compiled with different settings.</li>
<li>If the Lua library used to build wxLua is too different from the Lua library used to build the 3rd-party library you should expect your application to crash.</li>
<li>Ideally, you should compile wxLua and ALL 3rd-party libraries with the same compiler settings and against the EXACT SAME Lua library and its headers.</li>
<li>Use these proxy-dlls with 3rd-party libraries at your own risk and NO guarantee is made that they are suitable for any purpose...</li>
<li>They will, however, work perfectly with the wxLua compiled lua.exe and wx.dll.</li>
</ul></li>
<li><code>wxLua/modules/wxlua</code>
<ul>
<li>The base wxLua library, contains the wxLuaState class that wraps a lua_State and loads the bindings.</li>
</ul></li>
<li><code>wxLua/modules/wxbind</code>
<ul>
<li>The wxLua bindings for wxWidgets broken up by the wxWidgets libraries: <code>adv, aui, base, core, gl, html, media, net, richtext, stc, xml, xrc</code>.</li>
<li>To determine what classes are part of what libs you can use the <a href="wxluaref.html">wxluaref.html</a> document and search for the class.</li>
<li>For example, class wxGrid is in the file wxadv_grid.i so it is part of the adv library.</li>
</ul></li>
<li><code>wxLua/modules/wxluadebug</code>
<ul>
<li>Classes for debugging Lua in C++; wxLuaCheckStack and wxLuaStackDialog.</li>
</ul></li>
<li><code>wxLua/modules/wxluadebugger</code>
<ul>
<li>Debugger socket classes to run a wxLua program in a separate process and communicate with the parent debugger.</li>
</ul></li>
</ul>
<p><a name="C3.3"/></p>
<h3 id="wxlua-utilities">3.3 - wxLua Utilities</h3>
<ul>
<li><code>wxLua/utilities/bin2c.lua</code>
<ul>
<li>Lua script to convert any text file to a 'C' const char* string.</li>
</ul></li>
</ul>
<p><a name="C4"/></p>
<h2 id="building-wxlua">4 - Building wxLua</h2>
<p>wxLua uses uses CMake as its build system. The <code>CMakeLists.txt</code> files describe how wxLua is to be built so that when CMake is run it can generate the appropriate build files for the compiler of your choice.</p>
<p>There is also a <code>Makefile.wx-config</code> in the root directory of the wxLua that can be used to build wxLua using GCC in Linux. It simply requires that the wxWidgets <code>wx-config</code> script is in the path to work. These files are kept as a backup, they work, but the CMake build is preferred since it is far more flexible.</p>
<p><a name="C4.1"/></p>
<h3 id="getting-the-wxlua-source-code">4.1 - Getting the wxLua Source Code</h3>
<ul>
<li>For more information see : <a href="http://wxlua.sourceforge.net/download.php">http://wxlua.sourceforge.net/download.php</a></li>
<li>Briefly, download a source code archive <a href="http://sourceforge.net/projects/wxlua/files/wxlua/">http://sourceforge.net/projects/wxlua/files/wxlua/</a> for your platform.</li>
<li>Or use subversion to get the most up to date source code or the code at a specific revision number.
<ul>
<li>For more information see here : <a href="http://sourceforge.net/scm/?type=svn&amp;group_id=140042">http://sourceforge.net/scm/?type=svn&amp;group_id=140042</a></li>
<li>To get the latest trunk, use this command :
<ul>
<li><code>svn checkout https://wxlua.svn.sourceforge.net/svnroot/wxlua/trunk/wxLua wxLua-trunk</code></li>
</ul></li>
</ul></li>
<li>Do not checkout into a directory name with spaces to make your life easier.</li>
</ul>
<p><a name="C4.2"/></p>
<h3 id="initial-cmake-setup">4.2 - Initial CMake Setup</h3>
<ol style="list-style-type: decimal">
<li>Install CMake version &gt;= 2.8
<ul>
<li>In MSW and OSX download and run the installer from <a href="http://www.cmake.org/cmake/resources/software.html">http://www.cmake.org/cmake/resources/software.html</a></li>
<li>In Linux you can typically install the CMake package that your Linux distribution provides.</li>
</ul></li>
<li>Run the cmake-gui program.</li>
<li>Choose the compiler you wish to use, it should match the compiler wxWidgets was compiled with.
<ul>
<li>Select &quot;Use default native compilers&quot; unless you have some reason not to.</li>
</ul></li>
<li>Select the root of the wxLua directory as the &quot;Where is the source code&quot; directory, it has the root <code>CMakeLists.txt</code> file in it and subdirectories of <code>apps, art, bindings, modules, ...</code>.</li>
<li>Select a directory, perhaps named <code>wxLua-build</code>, at the same level as the <code>wxLua/</code> directory for &quot;Where to build the binaries.&quot;
<ul>
<li>The build directory can be anywhere, but ideally not the same as the wxLua source code directory since you may want to completely delete it.</li>
<li>If anything goes very wrong, consider deleting the build directory you created so you can start fresh.</li>
<li>If you drasticly change the CMake build settings after having compiled wxLua you should simply start with a new build directory. Everything will have to be rebuilt anyway and once the new settings are applied you can no longer <code>clean</code> the old files that have different names.</li>
</ul></li>
<li>Choose the type of library you want, static or shared libs (DLLs), by setting the <code>BUILD_SHARED_LIBS</code> variable.
<ul>
<li>Typically this will match what your wxWidgets build is.</li>
<li>By default, a shared version of wxWidgets will be used if <code>BUILD_SHARED_LIBS</code> is TRUE, if available. See the build settings for particular compilers to choose the wxWidgets build you actually want.</li>
</ul></li>
<li>Press the &quot;Configure&quot; button a few times.
<ul>
<li>Each time configure is run more variables are found and these appear in red, reconfigure until no more items are red.</li>
<li>There will probably be an error configuring the first time through, this is normal since it takes a few passes to figure things out.</li>
<li>If the error persists after a few configures adjust the settings to fix the problem.</li>
</ul></li>
<li>Adjust the CMake variable wxWidgets_COMPONENTS to match what wxWidgets libraries you have and want to use.</li>
<li>Adjust the CMake variable wxLuaBind_COMPONENTS to match or have fewer libraries than the wxWidgets_COMPONENTS list.</li>
<li>Review the available settings in section <a href="#C4.3">4.3</a> before continuing.</li>
<li>Skip to the section below that is appropriate for your compiler to complete the build process.</li>
</ol>
<p><strong>ALWAYS CONFIGURE CMAKE MORE THAN ONCE to ensure that wxWidgets is properly found and the wxLua settings are synced to it.</strong> <br/> This also applies to the command-line cmake configuration too. Double check the cmake output to ensure that wxLua will be built to your specifications.</p>
<p><a name="C4.3"/></p>
<h3 id="cmake-configuration-variables">4.3 - CMake Configuration Variables</h3>
<p>Below are the CMake variables that you can and in some cases must adjust to build wxLua. If you want to run CMake from the command line you would specify these variables as : <code>cmake -DBUILD_SHARED_LIBS=TRUE ...</code></p>
<ul>
<li>BUILD_OUTPUT_DIRECTORY_ARCHIVE=&quot;/path/to/put/built/archive_lib files&quot;</li>
<li>BUILD_OUTPUT_DIRECTORY_LIBRARY=&quot;/path/to/put/built/library files&quot;</li>
<li>BUILD_OUTPUT_DIRECTORY_RUNTIME=&quot;/path/to/put/built/exe and dll files&quot;</li>
<li>BUILD_SHARED_LIBS=[TRUE, FALSE]
<ul>
<li>Build shared libs (DLLs in MSW) or static libs if FALSE (the default).</li>
</ul></li>
<li>BUILD_USE_MULTIPROCESSOR=[TRUE, FALSE]
<ul>
<li>Build using multiple processors in MSVC.</li>
<li>Does nothing using if using gcc, use 'make -j4' instead.</li>
</ul></li>
<li>BUILD_USE_PRECOMPILED_HEADERS=[TRUE, FALSE]
<ul>
<li>Build quicker by precompiling the headers in MSVC.</li>
<li>When using GCC, disable precompiled headers and install 'ccache' since it is even faster.</li>
</ul></li>
<li>BUILD_USE_SOLUTION_FOLDERS=[TRUE, FALSE]
<ul>
<li>Put projects into folders in MSVC, always a good idea.</li>
<li>Does nothing for other build systems.</li>
</ul></li>
<li>BUILD_VERBOSELY=[TRUE, FALSE]
<ul>
<li>Print more information when building.</li>
<li>In GCC you can run <code>make VERBOSE=1</code> to get the same effect if this was set to FALSE.</li>
</ul></li>
<li>BUILD_WARNINGS_HIGH=[TRUE, FALSE]
<ul>
<li>Build with more or less warnings.</li>
</ul></li>
<li>CMAKE_BUILD_TYPE=[Debug, Release, RelWithDebInfo, MinSizeRel]
<ul>
<li>Set the build for Debug, Release, Release with Debug Info, and Minimum Size Release (stripped).</li>
<li>This variable will not be shown in the CMake Gui when building with Visual Studio since you choose the build type in the MSVC IDE and you can build them all using the same CMake configuration.</li>
<li>For other compilers, you can only build one at a time so you will have to create a separate build directory for each different build type.</li>
<li>Do not try to change the build type in CMake and reuse the same build directory. It may work, but can cause problems, simply delete the current build dir or create a new one for the new build type.</li>
</ul></li>
<li>CMAKE_DEBUG_VARIABLES=[TRUE, FALSE]
<ul>
<li>Print all CMake variables to the log.</li>
</ul></li>
<li>CMAKE_INSTALL_PREFIX=&quot;/path/the/install/target/copies/the/files/to/after/building&quot;</li>
<li>CMAKE_SKIP_INSTALL_ALL_DEPENDENCY=[TRUE, FALSE]
<ul>
<li>Allow running install without having built all the targets.</li>
</ul></li>
<li>wxLuaBind_COMPONENTS=&quot;gl;stc;xrc;richtext;html;media;aui;adv;core;xml;net;base&quot;
<ul>
<li>Choose the wxWidgets libraries to build wxLua bindings for.</li>
<li>Note that libraries will be automatically removed if they are not in the wxWidgets_COMPONENTS list and a warning given.</li>
</ul></li>
<li>wxLuaBind_WXLUASETUP_DIR=&quot;wxLua/modules/wxbind/setup&quot;
<ul>
<li>You can provide an alternative <code>wxluasetp.h</code> to customize what parts of wxWidgets are compiled into the wxLua bindings.</li>
<li>By default, everything is built-in.</li>
</ul></li>
<li>wxLua_LUA_INCLUDE_DIR=&quot;/path/to/the/lua/include/directory&quot;
<ul>
<li>When building wxLua against an external Lua library set this to its include directory.</li>
<li>Set this variable only when not using the built-in Lua library.</li>
</ul></li>
<li>wxLua_LUA_LIBRARY=&quot;/path/to/the/lua library&quot; (lua.a/so/lib file)
<ul>
<li>When building wxLua against an external Lua library set this to the Lua library to link to.</li>
<li>Set this variable only when not using the built-in Lua library.</li>
</ul></li>
<li>wxLua_LUA_LIBRARY_BUILD_SHARED=[TRUE, FALSE]
<ul>
<li>Build the built-in Lua library as a shared or static library.</li>
</ul></li>
<li>wxLua_LUA_LIBRARY_USE_BUILTIN=[TRUE, FALSE]
<ul>
<li>Use either the built-in Lua library, choose 5.1 or 5.2 and shared or static.</li>
<li>Or an external Lua library, set include dir and library to link to.</li>
</ul></li>
<li>wxLua_LUA_LIBRARY_VERSION=[5.1, 5.2]
<ul>
<li>When building the built-in Lua library, specify either the 5.1 or 5.2 version.</li>
</ul></li>
<li>wxStEdit_COPY_SETUP0_TO_SETUP_H=[TRUE, FALSE]
<ul>
<li>Copy the wxstedit/include/wx/stedit/setup0.h file to the path specified by wxStEdit_SETUP_INCLUDE_PATH.</li>
</ul></li>
<li>wxStEdit_ROOT_DIR=&quot;/path/to/root/of/the/wxstedit/source/tree&quot;
<ul>
<li>This normally points to the built-in wxStEdit library, but you could change it to an external version if needed.</li>
</ul></li>
<li>wxStEdit_SETUP_INCLUDE_PATH=&quot;/path/to/wx/stedit/setup.h&quot;
<ul>
<li>The &quot;wx/stedit/setup0.h&quot; contains user defined setup information and needs to be copied to &quot;wx/stedit/setup.h&quot; where it can be modifed before compiling.</li>
<li>CMake takes care of the copying if wxStEdit_COPY_SETUP0_TO_SETUP_H is true and then this variable points to where it was copied to.</li>
<li>Only change this variable to point to your own copy if you need to modify the setup.h file, typically no changes are required.</li>
</ul></li>
<li>wxWidgets_COMPONENTS=[semicolon separated list of wxWidgets library names]
<ul>
<li>wxWidgets has a number of components that are either built into separate libs (default build) or into a monolithic lib.</li>
<li>Therefore you either specify the desired separate libs or the monolithic lib. The GL and scintilla libs are always built separately.</li>
<li>The order and the dependencies are important, the lists below show the correct order and the dependencies can be found here : <a href="http://docs.wxwidgets.org/trunk/page_libs.html">http://docs.wxwidgets.org/trunk/page_libs.html</a><br /></li>
<li>wxWidgets 2.8 : <code>gl;stc;scintilla;xrc;media;richtext;aui;html;adv;core;xml;net;base</code></li>
<li>wxWidgets 2.9 : <code>gl;stc;xrc;media;richtext;aui;html;adv;core;xml;net;base</code></li>
<li>wxWidgets 2.8 monolithic : <code>gl;mono</code></li>
<li>wxWidgets 2.9 monolithic : <code>gl;scintilla;mono</code></li>
<li>A warning will given if you specify a wxWidgets library that was not found.</li>
<li>Note that the contents of the monolithic library can't be easily known so it is assumed that it has everything.</li>
<li>If you get a linker error about &quot;unresolved symbols&quot; for a wxWidgets function you are probably missing the library for it.</li>
<li>Adjust the wxLuaBind_COMPONENTS to match the wxWidgets libraries that you are linking to or that are actually in your monolithic library.</li>
</ul></li>
</ul>
<p>MS Windows configuration options</p>
<ul>
<li>wxWidgets_CONFIGURATION=[msw, mswu]
<ul>
<li>Choose the Unicode or ANSI (non-Unicode) wxWidgets build.</li>
<li>If you have only built one or the other then this variable will be automatically set.</li>
<li>If you have built both, set this variable to choose which to link to.</li>
<li>Note that the wxWidgets puts the libs for both builds in the same directory, but with different names.</li>
</ul></li>
<li>wxWidgets_LIB_DIR=&quot;/path/to/wxWidgets/lib/{vc_lib, vc_dll, gcc_lib, gcc_dll, ...}&quot;
<ul>
<li>The wxWidgets directory with the compiled libraries.</li>
</ul></li>
<li>wxWidgets_ROOT_DIR=&quot;/path/to/wxWidgets&quot;
<ul>
<li>The root dir of wxWidgets that has <code>include/wx</code> as a subdirectory.</li>
</ul></li>
<li>wxWidgets_USE_REL_AND_DBG=[TRUE,FALSE]
<ul>
<li>Use both release and debug configurations.</li>
<li>You probably always want this checked if you have built both and you will not be able to check this if you do not have both a release and debug configuration in the wxWidgets lib dir.</li>
</ul></li>
<li>wxWidgets_VERSION=[2.8.x,2.9.x]
<ul>
<li>In order to help find all the libs you may have to set this variable to the correct wxWidgets version as a hint to CMake.</li>
<li>This is because different wxWidgets versions have different libs and it is hard to tell if a lib is missing or if a different version is being used.</li>
</ul></li>
</ul>
<p>Linux and OSX configuration options</p>
<ul>
<li>wxWidgets_CONFIG_EXECUTABLE=/path/to/wx-config
<ul>
<li>Set the path to the <code>wx-config</code> script that CMake can use to get everything it needs to know about the wxWidgets library.</li>
</ul></li>
</ul>
<p><a name="C4.4"/></p>
<h3 id="cmake-with-msvc">4.4 - CMake with MSVC</h3>
<ol style="list-style-type: decimal">
<li>To find wxWidgets you must set the CMake variable
<ul>
<li><code>wxWidgets_ROOT_DIR=/path/to/wxWidgets</code></li>
</ul></li>
<li>Press &quot;Configure,&quot; but it probably won't work just yet.</li>
<li>To find the libraries for wxWidgets (you may have compiled a variety of them) you must also set the variable
<ul>
<li><code>wxWidgets_LIB_DIR=/path/to/wxWidgets/lib/vc_lib</code></li>
<li>Where you must set <code>vc_lib</code> appropriately; <code>vc_amd64</code> for 64-bit, <code>vc_dll</code> for DLLs, and <code>vc_amd64_dll</code> for 64-bit DLLs</li>
</ul></li>
<li>Press &quot;Configure&quot; again, if it doesn't work set
<ul>
<li><code>wxWidgets_CONFIGURATION=[msw, mswu]</code></li>
</ul></li>
<li>Press &quot;Configure&quot; again, if it doesn't work set
<ul>
<li><code>wxWidgets_VERSION=[2.8.x,2.9.x]</code></li>
<li>Where you will use the actual number, 2.8.12 or 2.9.4 for example.</li>
</ul></li>
<li>If &quot;Configure&quot; still doesn't work, then something is wrong with your wxWidgets build... go back and fix it.</li>
<li>If &quot;Configure&quot; succeeds, the output window should say &quot;Configuring done&quot; and the log should have a complete description of your wxWidgets build.</li>
<li>Press &quot;Generate&quot; to have CMake write out the build files.</li>
<li>Open <code>wxLua.sln</code> in the build directory...</li>
<li>Choose the &quot;Solution Configuration&quot; (<code>Debug, Release, MinSizeRel, RelWithDebInfo</code>) that matches your wxWidgets build and build everything.
<ul>
<li>Note that you MUST have built wxWidgets in debug for a wxLua <code>Debug</code> build, but a wxWidgets release build works with a wxLua <code>Release, MinSizeRel, RelWithDebInfo</code> build.</li>
</ul></li>
<li>All the apps are put into <code>build\bin\Debug</code> or <code>Release, MinSizeRel, RelWithDebInfo</code> as appropriate.</li>
<li>Right-click on &quot;wxLua_app&quot; and select as &quot;Startup project&quot; and press the &quot;Start Debugging&quot; program to run it in the GUI... etc.</li>
<li>If you built as a DLL using the wxWidgets DLLs you will have to either have the wxWidgets DLLs in you PATH environment variable or copy them into the same directory as the wxLua executables.
<ul>
<li>If you run a program and it silently closes with no error you can open a <code>cmd.exe</code> (DOS) prompt and run it there and, if you're lucky, an error message about a missing DLL will be printed to the console.</li>
</ul></li>
</ol>
<p><a name="C4.5"/></p>
<h3 id="cmake-with-mingw">4.5 - CMake with MinGW</h3>
<ul>
<li>See the section above titled <a href="#C2.4">Build using MinGW</a> for more information about getting and using MinGW.</li>
</ul>
<p><br/></p>
<ol style="list-style-type: decimal">
<li>Choose the <code>CMAKE_BUILD_TYPE</code> that you want.
<ul>
<li>Note that you MUST have built wxWidgets in debug for a wxLua <code>Debug</code> build, but a wxWidgets release build works with a wxLua <code>Release, MinSizeRel, RelWithDebInfo</code> build.</li>
</ul></li>
<li>To find wxWidgets you must set the variable
<ul>
<li><code>wxWidgets_ROOT_DIR=/path/to/wxWidgets</code></li>
</ul></li>
<li>Press &quot;Configure,&quot; but it probably won't work just yet.</li>
<li>To find the libraries for wxWidgets (you may have compilied a variety of them) you must also set the variable
<ul>
<li><code>wxWidgets_LIB_DIR=/path/to/wxWidgets/lib/gcc_lib</code></li>
<li>Where you must set <code>gcc_lib</code> appropriately; <code>gcc_dll</code> for DLLs.</li>
</ul></li>
<li>Press &quot;Configure&quot; again, if it doesn't work set
<ul>
<li><code>wxWidgets_CONFIGURATION=[msw, mswu]</code></li>
</ul></li>
<li>Press &quot;Configure&quot; again, if it doesn't work set
<ul>
<li><code>wxWidgets_VERSION=[2.8.x,2.9.x]</code></li>
</ul></li>
<li>If &quot;Configure&quot; still doesn't work, then something is wrong with your wxWidgets build... go back and fix it.</li>
<li>If &quot;Configure&quot; succeeds, the output window should say &quot;Configuring done&quot; and the log should have a complete description of your wxWidgets build.</li>
<li>Press &quot;Generate&quot; to have CMake write out the build files.</li>
<li>Open a <code>cmd.exe</code> prompt to run <code>mingw32-make.exe help</code> to display all the available targets.</li>
<li>If you run <code>mingw32-make.exe</code> with no parameters you will build everything, which is probably best.</li>
<li>All the apps are put into <code>build\bin\Debug</code> or <code>Release, MinSizeRel, RelWithDebInfo</code> as appropriate.</li>
</ol>
<p><a name="C4.6"/></p>
<h3 id="cmake-with-gcc-in-linux-or-osx">4.6 - CMake with GCC in Linux or OSX</h3>
<ol style="list-style-type: decimal">
<li>Choose the <code>CMAKE_BUILD_TYPE</code> that you want.
<ul>
<li>Note that in Linux you can mix and match Release and Debug versions.</li>
</ul></li>
<li>To find wxWidgets you must set the variable
<ul>
<li><code>wxWidgets_CONFIG_EXECUTABLE=/path/to/wx-config</code></li>
<li>See above about building wxWidgets for Linux for a description of it.</li>
</ul></li>
<li>Press &quot;Configure&quot; and the output window should say &quot;Configuring done&quot; and the log should have a complete description of your wxWidgets build.</li>
<li>Press &quot;Generate&quot; to have CMake write out the build files.</li>
<li>Open a terminal, change into your wxLua build dir and run <code>make help</code> to display all the available targets.</li>
<li>If you run <code>make</code> with no parameters you will build everything, which is probably best.</li>
<li>All the apps are put into <code>build\bin\Debug</code> or <code>Release, MinSizeRel, RelWithDebInfo</code> as appropriate.</li>
<li>You can run all the apps without installing them.</li>
</ol>
<p><a name="C5"/></p>
<h2 id="advanced-building">5 - Advanced Building</h2>
<p>These instructions are for developers who wish to customize wxLua's wxWidgets bindings or for those who want to use wxLua as a script interpreter in their own C++ project.</p>
<p><a name="C5.1"/></p>
<h3 id="building-a-minimal-set-of-wxwidgets-wrappers">5.1 - Building a minimal set of wxWidgets wrappers</h3>
<p>The functionality of wxLua's wxWidgets bindings are limited by your wxWidgets build settings; i.e. if you built wxWidgets with <code>wxUSE_TIMER=0</code> then you will not be able to use the wxTimer class in wxLua.</p>
<p>If you want all of the wxWidgets API that's available in your wxWidgets build wrapped by wxLua, simply build wxLua using the directions above, no modifications required.</p>
<p>On the other hand, if you wish to make the wxLua bindings smaller, you will need to set the CMake variable <code>wxLuaBind_WXLUASETUP_DIR</code> to point to the directory of a customized <code>wxluasetup.h</code> header which should start as a copy of <code>modules/wxbind/setup/wxluasetup.h</code>. It is best to copy it to a new directory instead of modifying the original one. This way you will have the original as a backup to compare your changes to.</p>
<p>The <code>wxluasetup.h</code> header file contains a number of <code>wxLUA_USE_XXX</code> #defines that are fairly self explanitory. By setting some of them to <code>0</code> you can block out large chunks of the wxWidgets bindings making the library smaller.</p>
<p>Be careful about which parts you remove since you can badly cripple your ability to create and use higher-level objects if you disable the lower-level parts they rely on. Though, this may be your goal, some experimentation may be required.</p>
<p>Once you have created and edited your <code>wxluasetup.h</code> you can build your custom wxLuaBind library following the directions above.</p>
<p><a name="C5.2"/></p>
<h3 id="embedding-wxlua-into-a-c-application">5.2 - Embedding wxLua into a C++ Application</h3>
<p>In order to embed wxLua in your project, you will need the <code>wxLua/modules/lua</code> and <code>wxLua/modules/wxlua</code> libraries at a minimum. With these two libraries you have the ability to start an interpreter and run straight Lua code in it using the wxLuaState class.</p>
<p>To enable creation and use of wxWidgets objects in Lua you will also need to build and link to the libraries in <code>modules/wxbind</code>. The wxWidgets bindings contain the appropriate <code>#if wxUSE_XXX</code> statements and platform dependent <code>#ifdef __WXMSW/GTK/MAC__</code> checks that wxWidgets uses in its headers to ensure that no matter what platform or what type of build you use, the bindings will compile without errors (if they don't compile for your settings, please be sure to tell us on the <script type="text/javascript">
<!--
h='&#108;&#x69;&#x73;&#116;&#x73;&#46;&#x73;&#x6f;&#x75;&#114;&#x63;&#x65;&#102;&#x6f;&#114;&#x67;&#x65;&#46;&#110;&#x65;&#116;';a='&#64;';n='&#x77;&#120;&#108;&#x75;&#x61;&#x2d;&#x75;&#x73;&#x65;&#114;&#x73;';e=n+a+h;
document.write('<a h'+'ref'+'="ma'+'ilto'+':'+e+'">'+'wxlua-users mailing list'+'<\/'+'a'+'>');
// -->
</script><noscript>&#x77;&#120;&#108;&#x75;&#x61;&#x2d;&#x75;&#x73;&#x65;&#114;&#x73;&#32;&#x6d;&#x61;&#x69;&#108;&#x69;&#110;&#x67;&#32;&#108;&#x69;&#x73;&#116;&#32;&#40;&#x77;&#120;&#108;&#x75;&#x61;&#x2d;&#x75;&#x73;&#x65;&#114;&#x73;&#32;&#x61;&#116;&#32;&#108;&#x69;&#x73;&#116;&#x73;&#32;&#100;&#x6f;&#116;&#32;&#x73;&#x6f;&#x75;&#114;&#x63;&#x65;&#102;&#x6f;&#114;&#x67;&#x65;&#32;&#100;&#x6f;&#116;&#32;&#110;&#x65;&#116;&#x29;</noscript>).</p>
<p><a name="C5.3"/></p>
<h3 id="wxlua-libraries-and-linking-order">5.3 - wxLua libraries and linking order</h3>
<p>The order in which you link to the wxLua libraries is important. You must always link to any binding library <strong>after</strong> (in terms of initialization) linking with the wxLua libraries.</p>
<p><strong>NOTE</strong>: Many linkers actually link libraries in the opposite order in which they appear on the command line. This means that the libraries that are first in the linker list are initialized last.</p>
<ul>
<li>The library order for the gcc/MSVC linker is:
<ul>
<li><code>wxbind..., wxbindcore, wxbindbase, wxluadebugger, wxluadebug, wxlua, lua, wxWidgets libs</code></li>
</ul></li>
<li>Obviously, you should remove the libraries you don't use (e.g. wxluadebugger, wxluadebug)</li>
<li>wxLua names its libraries similarly to the wxWidgets naming convention:
<ul>
<li><code>{wxlua_libname}-wx$(WX_VERSION_MAJOR)$(WX_VERSION_MINOR)$(WX_PORT)$(WXLIBPOSTFIX)</code></li>
<li><code>WX_PORT</code> can be <code>gtk2, msw, x11, etc</code></li>
<li><code>WXLIBPOSTFIX</code> can be <code>u, d, ud</code>.</li>
<li>E.G. <code>libwxlua-wx29gtk2ud-2.8.12.so, libwxlua_debug-wx29gtk2ud-2.8.12.so,     libwxlua_debugger-wx29gtk2ud-2.8.12.so, libwxlua_bind-wx29gtk2ud-2.8.12.so</code></li>
</ul></li>
</ul>
</body>
</html>
